package snowflake

import (
	"fmt"

	"github.com/bwmarrin/snowflake"
	"github.com/gogf/gf/v2/util/grand"
)

func Generate() snowflake.ID {
	nodeId := grand.N(1, 32)
	node, err := snowflake.NewNode(int64(nodeId))
	if err != nil {
		fmt.Println(err)
		return 0
	}

	// Generate a snowflake ID.
	return node.Generate()
}
